package com.xiaow.springsecuriydemo.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xiaow.springsecuriydemo.entity.Trading;
import com.xiaow.springsecuriydemo.mapper.TradingMapper;
import com.xiaow.springsecuriydemo.service.TradingService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.xiaow.springsecuriydemo.vo.TradingVo;
import com.xiaow.springsecuriydemo.vo.TradingVo2;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 服务实现类
 * </p>
 *
 * @author xiaow
 * @since 2022-09-17
 */
@Service
public class TradingServiceImpl extends ServiceImpl<TradingMapper, Trading> implements TradingService {


    /**
     * 根据用户id获取订单信息
     *
     * @param userId
     * @return
     */
    @Override
    public List<TradingVo> getByUserId(Long userId) {
        return baseMapper.getByUserId(userId);
    }

    @Override
    public IPage<TradingVo2> getByShopId(Integer shopId, IPage<TradingVo2> page) {
        IPage<TradingVo2> byShopId = baseMapper.pageByShopId(page, shopId);
        System.out.println(byShopId);
        return byShopId;
    }

    @Override
    public IPage<TradingVo2> pageByHot(IPage page) {
        return null;
    }

    @Override
    public IPage<TradingVo2> getReturnApply(IPage page, Integer shopid) {
        return baseMapper.getReturnApply(page, shopid);
    }
}
